import sys

# ----------------------------------------------------

import wx
import wx.aui
import wx.py 
import wx.glcanvas
import wx.lib.flatnotebook as fnb

from demoEnginePython import *

#---------------------------------------------------------------------------

class TestFrame(wx.Frame):
    def __init__(self, parent=None, ID=-1, title='pyOSG' ):
        wx.Frame.__init__(self, parent, ID, title)
        
        #-- shell---------------------------------------------
        self.SetSize(wx.Size(800,600))
        self.shell = wx.py.shell.Shell(self, -1, introText="",style =wx.NO_BORDER)

        # --- OSG ---------------------------------
        self.node = Node()
        r = self.node.Load("cow.osg")
        print r 
        self.viewer = Viewer()
        self.viewer.SetRoot(self.node)

        # --- Timer ---------------------------------
        self.timer = wx.Timer(self,-1)
        self.timer.Start(1) 

        # --- Bindings ---------------------------------
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_TIMER, self.OnTimer, id=self.timer.GetId() )
                
    def OnClose(self, event):
        self.viewer.setSceneData(None)
        self.Destroy()
        
    def OnTimer(self,e):
        self.viewer.Frame()
        
#---------------------------------------------------------------------------

class TestApp(wx.App):
    def OnInit(self):
        self.Frame = TestFrame()
        self.SetTopWindow(self.Frame)
        self.Frame.Show() 
        return True
   
#---------------------------------------------------------------------------

if __name__ == '__main__':
    app = TestApp(0)
    app.MainLoop()
    
    

